<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/3/5
  Time: 15:19
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../../../base.jsp" %>
<div class="modal-header">
    <h3 class="text-center text-primary">
        试卷
    </h3>

    <div class="text-left">
        <button type="button" class="btn btn-default" onclick="paper.goBack('${paperId}','${paperCardId}')">
            &lt;&ensp;返回
        </button>
        <button type="button" class="btn btn-primary <c:if test="${empty paperId}">hidden</c:if>"
                onclick="paper.showFrom();">修改
        </button>
    </div>
</div>
<div class="text-left">
    <br>
    <div>
        <%--添加/修改试卷--%>
        <form id="paperForm" class="form-horizontal text-left editForm <c:if test="${!empty paperId}">hidden</c:if>">
            <input class="hidden" value="${growthId}" name="paper.growthId">
            <input class="hidden" value="${paper.paperId}" name="paper.paperId">
            <div class="form-group">
                <label class="col-sm-2 control-label">试卷描述(测试说明)</label>
                <div class="col-sm-8">
                    <textarea id="paperDescr" class="form-control" rows="3" name="paper.descr"
                              placeholder="试卷描述">${paper.descr}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">tips</label>
                <div class="col-sm-8">
                    <textarea class="form-control" rows="3" name="paper.tips"
                              placeholder="tips">${paper.tips}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">排序号</label>
                <div class="col-sm-8">
                    <input type="number" class="form-control" name="paper.rank" placeholder="排序号" value="${paper.rank}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态</label>
                <div class="col-sm-8">
                    <select class="form-control" name="paper.status">
                        <option value="0" <c:if test="${paper.status == 0}"> selected</c:if> >默认（未发布）</option>
                        <option value="50" <c:if test="${paper.status == 50}"> selected</c:if> >发布</option>
                        <option value="99" <c:if test="${paper.status == 99}"> selected</c:if> >废除</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">操作</label>
                <div class="col-sm-8">
                    <button type="button" class="btn btn-danger " onclick="paper.save()">
                        <%--<c:if test="${empty paperId}">下一步</c:if>--%>
                        <%--<c:if test="${!empty paperId}">提交修改</c:if>--%>
                        提交
                    </button>
                    <button type="button" class="btn btn-default <c:if test="${empty paperId}">hidden</c:if>"
                            onclick="paper.editFrom();">取消
                    </button>
                </div>
            </div>
        </form>
        <%--查看试卷详情--%>
        <form class="showFrom form-horizontal showForm text-left <c:if test="${empty paperId}">hidden</c:if>">
            <div class="form-group">
                <label class="col-sm-2 control-label">试卷描述(测试说明)</label>
                <div class="col-sm-8">
                    <p class="form-control-static">${paper.descr}</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">tips</label>
                <div class="col-sm-8">
                    <p class="form-control-static">${paper.tips}</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">排序号</label>
                <div class="col-sm-8">
                    <p class="form-control-static">${paper.rank}</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">状态</label>
                <div class="col-sm-8">
                    <c:if test="${paper.status == 0}">默认（未发布）</c:if>
                    <c:if test="${paper.status == 50}">发布</c:if>
                    <c:if test="${paper.status == 99}">废除</c:if>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">试题列表</label>
                <div class="col-sm-8">
                    <div class="list-group">
                        <c:forEach items="${questionList}" var="questionVo" varStatus="vs">
                            <%--<i class="glyphicon glyphicon-list-alt"></i>--%>
                            <p class="form-control-static list-group-item active">
                                <c:if test="${questionVo.papaerQuestion.status == 99}">
                                    <i style="color: red;">[问题已废除]</i>
                                </c:if>
                                <c:if test="${questionVo.papaerQuestion.status == 50}">
                                    <i style="color: green;">[已发布]</i>
                                </c:if>
                                    ${questionVo.papaerQuestion.questionContent}
                            </p>
                            <%--<p class="form-control-static">答案选项:</p>--%>
                            <c:forEach items="${questionVo.optionList}" var="option" varStatus="optionVS">
                                <div class="list-group-item">
                                    <c:if test="${option.status == 99}">
                                        <i style="color: red;">[答案选项已废除]</i>
                                    </c:if>
                                    <c:if test="${option.status == 50}">
                                        <i style="color: green;">[已发布]</i>
                                    </c:if>
                                    <p class="form-control-static bg-success">${option.content}</p>
                                    <p class="form-control-static bg-warning">${option.analysis}</p>
                                    <p class="form-control-static bg-info ">${option.score}</p>
                                </div>
                            </c:forEach>
                        </c:forEach>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">task</label>
                <div class="col-sm-8">

                    <div class="list-group">
                        <c:forEach items="${paperTaskList}" var="task" varStatus="taskVS">
                            <p class="form-control-static bg-success bg-danger list-group-item">
                                <c:if test="${task.status == 99}">
                                    <i style="color: red;">[task已废除]</i>
                                </c:if>
                                <c:if test="${task.status == 50}">
                                    <i style="color: green;">[已发布]</i>
                                </c:if>
                                    ${task.descr}
                            </p>
                        </c:forEach>
                    </div>

                </div>
            </div>
        </form>
    </div>
</div>

<script src="${basePath}js/paper_js/paper.js"></script>
